<%--
  Created by IntelliJ IDEA.
  User: apple
  Date: 2022/4/26
  Time: 3:41 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%String path = request.getContextPath()+"/";%>
<!doctype html>
<html>
<head>
    <base href="<%=path%>">
    <title>用户管理</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min.css?v=3.3.7" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="js/plugins/treegrid/jquery.treegrid.css" rel="stylesheet">
    <link href="js/plugins/treegrid/bootstrap-table.min.css" rel="stylesheet">
    <link href="css/plugins/switchery/switchery.css" rel="stylesheet">
    <link href="js/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet">
</head>
<body class="gray-bg" style="background-color: #f3f3f4;overflow-x: hidden;">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-md-12" style="border:0px solid red;padding:0px;">
            <div class="row " style="padding:10px;background-color:#ffffff;margin: 10px;border-radius: 10px;box-shadow: 1px 1px 3px;">
                <div class="col-md-12" style="line-height: 50px;">
                    <form class="form-inline">
                        <div class="form-group">
                            <label for="exampleInputName2">资源名称</label>
                            <input type="text" class="form-control" id="exampleInputName2" name="resourceName" placeholder="资源名称">
                        </div>
                        <div class="form-group">
                            <label for="status">部门状态</label>
                            <select class="form-control" name="status">
                                <option value="-1">全部</option>
                                <option value="0">启用</option>
                                <option value="1">停用</option>
                            </select>
                        </div>
                        <button type="button" class="btn btn-success" onclick="$.table.refresh();"><i class="glyphicon glyphicon-search"></i> 搜索</button>
                        <button type="button" class="btn btn-warning" onclick="$.table.reset();"><i class="glyphicon glyphicon-refresh"></i>重置</button>
                    </form>
                </div>
            </div>
            <div class="row" style="padding:10px;background-color:#ffffff;margin: 10px;border-radius: 10px;;box-shadow: 1px 1px 3px;">
                <div class="col-md-12">
                    <table id="table">
                    </table>
                    <div id="tools">
                        <button type="button" class="btn btn-warning" onclick="$.modal.add('新增资源信息','resource/toEdit',['800px','500px']);"><i class="glyphicon glyphicon-plus"></i>新增</button>
                        <button type="button" class="btn btn-warning" onclick="$.modal.editTools('id','编辑部门信息','resource/toEdit?id=');"><i class="glyphicon glyphicon-edit"></i>修改</button>
                        <button type="button" class="btn btn-warning" onclick="$.modal.removes('id','resource/deletes');"><i class="glyphicon glyphicon-trash"></i>删除</button>
                        <button type="button" class="btn btn-warning" onclick="$.tableTree.expandOrCollspse();"><i class="glyphicon glyphicon-export"></i>展开/折叠</button>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

<!-- 全局js -->
<script src="js/jquery.min.js?v=2.1.4"></script>
<script src="js/bootstrap.min.js?v=3.3.7"></script>
<script src="js/plugins/treegrid/jquery.treegrid.min.js"></script>
<script src="js/plugins/treegrid/bootstrap-table.min.js"></script>
<script src="js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="js/plugins/treegrid/bootstrap-table-treegrid.min.js"></script>
<script src="js/plugins/layer/layer.min.js"></script>
<script src="js/sofwin.js"></script>
</body>
<style>
</style>
<script>

    $(function() {
        var options={
            url:'resource/data',
            idField:'id',
            treeShowField:'name',
            parentIdField:'parentId',
            columns:[
                {
                    checkbox: true
                },
                {
                    field: 'name',
                    title: '资源名称'
                },
                {
                    field:'shortNum',
                    title:'排序'
                },{
                    field: 'path',
                    title: '请求地址'
                },{
                    field: 'resourceType',
                    title: '类型'
                },
                {
                    field: 'status',
                    title: '状态',
                    sortable: true,
                    align: 'center',
                    formatter: function(value, row, index){
                        if (value === 0) {
                            return '<span class="label label-success">正常</span>'
                        }
                        return '<span class="label label-danger">停用</span>'
                    }
                },{
                    field: 'permission',
                    title: '权限标识'
                },
                {
                    title:'操作',
                    formatter:function(value,row,index,field){
                        return '<button type="button" class="btn btn-warning btn-xs" onclick="$.modal.edit(\'编辑资源信息\',\'resource/toEdit?id='+row.id+'\');"><i class="glyphicon glyphicon-edit"></i>修改</button>\n' +
                            '                        <button type="button" class="btn btn-warning btn-xs" onclick="$.modal.remove(\'resource/delete/'+row.id+'\',\''+row.id+'\')"><i class="glyphicon glyphicon-trash"></i>删除</button>\n';


                    }
                }
            ]
        };
        $.tableTree.init(options);
    })


</script>

</html>